最近の更新 | |
---|---|
監視カメラ
| 2024/01/14 |
加湿器
| 2023/12/14 |
pdfで数字だけ印刷されない現象に遭遇
| 2023/10/25 |
grep日本語検索
| 2023/10/12 |
キーボード
| 2023/08/27 |
知のポートフォリオ
| 2023/07/29 |
ドングルの死
| 2023/06/04 |
ヒートポンプ
| 2023/05/31 |
ドメイン運用
| 2023/05/21 |
太陽光発電_奮闘記
| 2023/04/09 |
AWSコスト削減
| 2022/12/04 |
ClamAV
| 2022/08/31 |
github
| 2022/08/08 |
社内LAN敷設
| 2022/05/03 |
Let's Encrypt
| 2022/05/02 |
Nuroに切り替えてNetwork-Printerにつながらなくなりました
| 2022/05/01 |
突然LANがつながらなくなりました
| 2022/04/30 |
藤井厳喜セミナー
| 2022/02/09 |
資金調達
| 2022/02/09 |
車と税金
| 2022/02/09 |
無料SSL証明書を発行してくれる認証局があることを知りました Let's Encrypt と言うそうです。
ありがたいことです。
$ sudo apt-get install certbot $ sudo apt-get install python3-certbot-apache
$ sudo systemctl stop apache2 $ sudo certbot --authenticator standalone --installer apache -w /var/www/html -d wtech.jp Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1
下記ファイルが生成されてます:
/etc/letsencrypt/live/wtech.jp/ cert.pem -> ../../archive/wtech.jp/certN.pem chain.pem -> ../../archive/wtech.jp/chainN.pem fullchain.pem -> ../../archive/wtech.jp/fullchainN.pem privkey.pem -> ../../archive/wtech.jp/privkeyN.pem
ここで N は初回 1, 以降更新ごとに 2, 3, ... となるようです。
90日で期限が一旦切れるので、その時にでも更新手順をチェックしておきます。
(2019/04/21) ワイルドカード証明書は90日後の更新時、 自動で更新してくれないようです。
各自で DNS にアクセスする更新スクリプトを用意しないといけないようで。
AWS route53 等は自動更新用のスクリプトがあるようですが、 私が使用している ホニャララ.com はざっと見た範囲ではありませんでした。
ワイルドカードは止めてその都度登録することにしようと思います。 どうせ数少ないし。
ということで、以下は単なるメモとして↓
---
*.wtech.jp があれば wtech.jp の証明書は要らないと思っていたのですが、 違ってました。 *.wtech.jp はあくまで wtech.jp のサブドメインのみのようなので、 wtech.jp 用は別途必要でした。
$ sudo add-apt-repository ppa:certbot/certbot $ sudo apt update $ sudo apt install certbot
$ sudo certbot certonly --manual -d *.wtech.jp --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
(2019/01/26) wtech.jp 用の _acme-challenge.wtech.jp TXTレコードとは別に *.wtech.jp 用の _acme-challenge.wtech.jp TXTレコードの計2つ要るようです。 これを誤解していて wtech.jp 用のキーに上書きしていたため renew 時に エラーになってしまいましたorz 最初からやり直しました。Please deploy a DNS TXT record under the name _acme-challenge.wtech.jp with the following value: ************************************** (実際はキー)
(*)おそらく、証明書を発行しようとする Let's Encrypt が 「正しく DNS 上に登録されているか」を確認するのだと思う。$ nslookup -q=txt _acme-challenge.wtech.jp ... Non-authoritative answer: _acme-challenge.wtech.jp text ="**************************************"
To non-interactively renew *all* of your certificates, run "certbot renew"
とのこと。
90日の期限切れの件。certbot.timer なる systemctl が自動的にやってくれていると思っていましたが、 ずっと止まっていたようで、certbot から「後何日で切れるよ」と言う通知が来ました。
で、期限切れ当日、手で renew すると
$ sudo certbot renew ... Attempting to renew cert (wtech.jp) from /etc/letsencrypt/renewal/wtech.jp.conf produced an unexpected error: Problem binding to port 80: Could not bind to IPv4 or IPv6.. Skipping.
とエラー。ググると、取り敢えず SSL(port 443) apache を止めると行けるとのことで、 取り敢えず今回はそれで切り抜けました(2019/03/03 時点)。
/var/log/syslog と /var/log/apache2/error.log を watch してみる。
$ sudo certbot revoke --cert-path /etc/letsencrypt/live/wtech.jp-0001/cert.pem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Would you like to delete the cert(s) you just revoked, along with all earlier and later versions of the cert? - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - (Y)es (recommended)/(N)o: y
※ ググると、 revoke 後に delete しないといけない、と言う記事がヒットしますが、 今は revoke コマンドで削除までやってくれるようです: